package com.smalluz.ad.modules.oe.api.impl;

import com.google.common.collect.ImmutableMap;
import com.smalluz.ad.modules.common.enums.MediaApiUrl;
import com.smalluz.ad.modules.oe.api.OeAccountService;
import com.smalluz.ad.modules.oe.api.OeService;
import com.smalluz.ad.modules.oe.result.Oauth2AdvertiserResult;

import lombok.RequiredArgsConstructor;


@RequiredArgsConstructor
public class OeAccountServiceImpl implements OeAccountService {
    private final OeService oeService;
    
    @Override
    public Oauth2AdvertiserResult getMajordomoAdvertiserList(String advertiserId) {
        String resultContent = oeService.get(MediaApiUrl.Account.ACCOUNT_OPEN_API_MAJORDOMO_ADVERTISER_SELECT, ImmutableMap.builder()
            .put("advertiser_id",advertiserId)
            .build());
        return Oauth2AdvertiserResult.fromJson(resultContent);
    }

}
